package com.ian.offer;

import java.util.Arrays;

/**
 * @author zhangyaowen
 * @date 2021/3/3 8:49 下午
 */
public class IsStraight {

    public boolean isStraight(int[] nums) {
        int j = 0;

        Arrays.sort(nums);

        for (int i = 0; i < nums.length-1; i++) {

            if (nums[i] ==0){
                j++;
            }else if (nums[i] ==nums[i+1]){
                return false;
            }
        }

        return nums[nums.length-1]-nums[j] <=5;
    }
}
